package cn.tx.dao.impl;

import org.apache.commons.lang.StringUtils;

import cn.tx.dao.ConsoleLogDao;
import cn.tx.model.ConsoleLog;
import cn.tx.query.ConsoleLogQuery;

public class ConsoleLogDaoImpl extends BaseDaoImpl<ConsoleLog, ConsoleLogQuery> implements ConsoleLogDao {

	@Override
	public String createHql(ConsoleLogQuery q) {
		String hql = "from ConsoleLog e where 1=1 ";
		String condition = this.createConditionHql(q);
		hql = hql + condition + "order by e.logId desc";
		return hql;
	}

	@Override
	public String createHqlCount(ConsoleLogQuery q) {
		String hql = "select count(e) from ConsoleLog e where 1=1 ";
		//StringUtils.isNotBlank判断当前的字符串是不是空串和null
		String condition = this.createConditionHql(q);
		hql = hql + condition;
		return hql;
	}

	@Override
	public String createConditionHql(ConsoleLogQuery q) {
		
		
		String hql =  " and e.entityId = :entityId and e.tableName like :tableName and e.optType like :optType ";
		
		
		return hql;
	}



}
